package thread;

public class DaemonThreadDemo {
    public static void main(String[] args) {
        Thread jack = new Thread(){
            @Override
            public void run() {
                while(true){
                    System.out.println("Jack:You jump,i jump!");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        };

        Thread rose = new Thread(){
            @Override
            public void run() {
                for (int i = 5;i>0;i--){
                    System.out.println("Rose:Let me go!");
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                System.out.println("Rose:aaaaaaa!\n扑通..");
            }
        };

        //rose.setPriority(6);
        //jack.setPriority(7);
        rose.start();
        jack.setDaemon(true);
        jack.start();
        System.out.println("程序底部");

        //while (true);
    }
}
